#pragma once
#include <LitExport.hpp>

#ifndef LIT__PLATFORM__INCLUDED__HH__
#define LIT__PLATFORM__INCLUDED__HH__

#ifndef LIT_PLATFORM

#define LIT_PLATFORM_WINDOWS		1
#define LIT_PLATFORM_UNIX			2
#define LIT_PLATFORM_LINUX			3
#define LIT_PLATFORM_MAC_OSX		4
#define LIT_PLATFORM_FREEBSD		5

#define LIT_ARCHITECTURE_UNKNOWN 0
#define LIT_ARCHITECTURE_X86 1
#define LIT_ARCHITECTURE_X64 2

#define LIT_PLATFORM_WINDOWS_NAME	"Windows"
#define LIT_PLATFORM_UNIX_NAME		"Unix"
#define LIT_PLATFORM_LINUX_NAME		"Linux"
#define LIT_PLATFORM_MAC_OSX_NAME	"Max OSX"
#define LIT_PLATFORM_FREEBSD_NAME	"FreeBDS"

#define LIT_ARCHITECTURE_X86_NAME "x86"
#define LIT_ARCHITECTURE_X64_NAME "x64"
#define LIT_ARCHITECTURE_UNKNOWN_NAME "Undefined"


#if defined(_WIN32) || defined(_WIN64)

#	ifdef _WIN64
#		define LIT_ARCHITECTURE			LIT_ARCHITECTURE_X64
#		define LIT_ARCHITECTURE_NAME	LIT_ARCHITECTURE_X64_NAME
#	elif defined(_WIN32)
#		define LIT_ARCHITECTURE			LIT_ARCHITECTURE_X86
#		define LIT_ARCHITECTURE_NAME	LIT_ARCHITECTURE_X86_NAME
#	else
#		define LIT_ARCHITECTURE			LIT_ARCHITECTURE_UNKNOWN
#		define LIT_ARCHITECTURE_NAME	LIT_ARCHITECTURE_UNKNOWN_NAME
#	endif

#	define LIT_PLATFORM					LIT_PLATFORM_WINDOWS
#	define LIT_PLATFORM_NAME			LIT_PLATFORM_WINDOWS_NAME

#elif defined(__unix) || defined(__unix__)

#	define LIT_ARCHITECTURE				LIT_ARCHITECTURE_X86
#	define LIT_ARCHITECTURE_NAME		LIT_ARCHITECTURE_X86_NAME
#	define LIT_PLATFORM					LIT_PLATFORM_UNIX
#	define LIT_PLATFORM_NAME			LIT_PLATFORM_UNIX_NAME

#elif defined(__APPLE__) || defined(__MACH__)

#	define LIT_ARCHITECTURE				LIT_ARCHITECTURE_X86
#	define LIT_ARCHITECTURE_NAME		LIT_ARCHITECTURE_X86_NAME
#	define LIT_PLATFORM					LIT_PLATFORM_MAC_OSX
#	define LIT_PLATFORM_NAME			LIT_PLATFORM_MAC_OSX_NAME

#elif defined(__linux__)

#	define LIT_ARCHITECTURE				LIT_ARCHITECTURE_X86
#	define LIT_ARCHITECTURE_NAME		LIT_ARCHITECTURE_X86_NAME
#	define LIT_PLATFORM					LIT_PLATFORM_LINUX
#	define LIT_PLATFORM_NAME			LIT_PLATFORM_LINUX_NAME

#elif defined(__FreeBSD__)

#	define LIT_ARCHITECTURE				LIT_ARCHITECTURE_X86
#	define LIT_ARCHITECTURE_NAME		LIT_ARCHITECTURE_X86_NAME
#	define LIT_PLATFORM					LIT_PLATFORM_FREEBSD
#	define LIT_PLATFORM_NAME			LIT_PLATFORM_FREEBSD_NAME

#endif

#define LIT_PLATFORM_ASSERT( platform_to_check ) assert( LIT_PLATFORM == platform_to_check )
#define LIT_PLATFORM_CHECK( platform_to_check ) ( LIT_PLATFORM == platform_to_check )

#endif

#endif